ListItemRenderer
| Kind of class: | class |
|---|---|
| Inherits from: | Button < UIComponent < MovieClip |
| Classpath: | gfx.controls.ListItemRenderer |
| File last modified: | Wednesday, 30 June 2010, 09:09:04 |
The ListItemRenderer derives from the CLIK Button class and extends it to include list-related properties that are useful for its container components. However, it is not designed to be a standalone component, instead it is only used in conjunction with the ScrollingList, TileList and DropdownMenu components.
Inspectable Properties
Since the ListItemRenderer’s are controlled by a container component and never configured manually by a user, they contain only a small subset of the inspectable properties of the Button.label: Sets the label of the ListItemRenderer. visible: Hides the button if set to false. disabled: Disables the button if set to true. enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects. soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects. States
Since it can be selected inside a container component, the ListItemRenderer requires the selected set of keyframes to denote its selected state. This component’s states include
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
Inspectable Properties
Since the ListItemRenderer’s are controlled by a container component and never configured manually by a user, they contain only a small subset of the inspectable properties of the Button.
Since it can be selected inside a container component, the ListItemRenderer requires the selected set of keyframes to denote its selected state. This component’s states include
- an up or default state.
- an over state when the mouse cursor is over the component, or when it is focused.
- a down state when the button is pressed.
- a disabled state.
- a selected_up or default state.
- a selected_over state when the mouse cursor is over the component, or when it is focused.
- a selected_down state when the button is pressed.
- a selected_disabled state.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
- type: The event type.
- target: The target that generated the event.
- show: The component's visible property has been set to true at runtime.
- hide: The component's visible property has been set to false at runtime.
- focusIn: The component has received focus.
- focusOut: The component has lost focus.
- select: The component's selected property has changed.
- selected: The selected property of the Button. Boolean property.
- stateChange: The button's state has changed.
- state: The Button's new state. String type, Values "up", "over", "down", etc.
- rollOver: The mouse cursor has rolled over the button.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- rollOut: The mouse cursor has rolled out of the button.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3. /li>
- press: The button has been pressed.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- doubleClick: The button has been double clicked. Only fired when the Button.doubleClickEnabled property is set.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- click: The button has been clicked.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- dragOver: The mouse cursor has been dragged over the button (while the left mouse button is pressed).
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- dragOut: The mouse cursor has been dragged out of the button (while the left mouse button is pressed).
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- releaseOutside: The mouse cursor has been dragged out of the button and the left mouse button has been released.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
Component metadata:
| InspectableList | "disableConstraints" "disabled" "enableInitCallback" "labelID" "visible" |
|---|
Summary
Constructor
Instance properties
- index
- The current index of the data that the itemRenderer contains.
- owner
- The component instance that owns this renderer.
- selectable
- Determines if the item renderer can be interacted with.
- selected
- Set the selected state of the Button.
Instance properties inherited from Button
_autoSize _disableConstraints _disableFocus _group _label _selected autoRepeat autoSize buttonRepeatDelay buttonRepeatDuration buttonRepeatInterval constraints data disableConstraints disabled disableFocus doubleClickDuration doubleClickEnabled doubleClickInterval focusIndicator group groupName inspectableGroupName label labelID lockDragStateChange pressedByKeyboard selected soundMap state stateMap textField toggle
Instance properties inherited from UIComponent
__height __width _disabled _displayFocus _focused addEventListener cleanUpEvents disabled dispatchEvent displayFocus enableInitCallback focused focusHandlerReference focusTarget hasEventListener height initialized invalidationIntervalID removeAllEventListeners removeEventListener sizeIsInvalid soundMap visible width
Class methods
Class methods inherited from UIComponent
Instance methods
- setListData
- Set the list data relevant to the itemRenderer.
- setData
- Sets data from the dataProvider to the renderer.
Instance methods inherited from Button
alignForAutoSize beginButtonRepeat calculateWidth changeFocus clearRepeatInterval configUI doubleClickExpired draw getStatePrefixes handleButtonRepeat handleClick handleDragOut handleDragOver handleInput handleMousePress handleMouseRelease handleMouseRollOut handleMouseRollOver handlePress handleRelease handleReleaseOutside setSize setState toString updateAfterStateChange
Instance methods inherited from UIComponent
Constructor
ListItemRenderer
function ListItemRenderer (
)
The constructor is called when a ListItemRenderer or a sub-class of ListItemRenderer is instantiated on stage or by using
attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend ListItemRenderer, ensure that a super() call is made first in the constructor. Instance properties
index
index:Number
(read,write)
The current index of the data that the itemRenderer contains.
selectable
selectable:Boolean = true
(read,write)
Determines if the item renderer can be interacted with.
To do:
- Non-selectable items are skipped when scrolling through the list
selected
selected:Boolean
(read,write)
Set the selected state of the Button. Buttons can have two sets of mouse states, a selected and unselected. When a Button's
toggle property is true the selected state will be changed when the button is clicked, however the selected state can be set using ActionScript even if the toggle property is false. Instance methods
setData
function setData (
data:Object) : Void
Sets data from the
dataProvider to the renderer. Parameters:
data:
The data associated with this itemRenderer.
setListData
function setListData (
index:Number,
label:String,
selected:Boolean) : Void
Set the list data relevant to the itemRenderer. Each time the item changes, or is redrawn by the
owner, the itemRenderer is updated using this method. Parameters:
index :
The index of the data the itemRenderer represents.
label :
The calculated label the itemRenderer should display.
selected:
The selected state of the itemRenderer.